<template>
	<view>

		<view>分享页面</view>
	</view>

</template>


<script>
	
	import request from '@/common/vmeitime-http/requstx.js'
	// #ifdef H5 
	var jweixin= require('@/components/jweixin-module/index.js');
	// #endif
	export default {


		data() {
			return {
				appId: "",
				timestamp: "",
				nonceStr: "",
				signature: ""
			}

		},

		onShow: function() {

			var url = location.href.split('#')[0];
           var   urlx=url;
		   console.log(JSON.stringify(url))
			request({
				url: "wechat/share",
				method: 'GET',
				data: {
					url:urlx

				},
				success: (res) => {



					this.appId = res.data.appid;
					this.timestamp = res.data.timestamp;
					this.nonceStr = res.data.noncestr;
					this.signature = res.data.signature;
					console.log(res.data)
					console.log(res.data.appid)
					console.log("获取" + this.appid)
					// #ifdef H5 
					jweixin.config({
						debug: true,
						appId: this.appId,
						timestamp: this.timestamp,
						nonceStr: this.nonceStr,
						signature: this.signature,
						jsApiList: ["onMenuShareAppMessage", "onMenuShareTimeline"]
					});
					jweixin.ready(function() {
						jweixin.checkJsApi({
							jsApiList: ["onMenuShareAppMessage", "onMenuShareTimeline"]
						});
						var shareData = {

							title: "测试分享vue",
							desc: "测试微信分享vue",
							link: this.weixinhttpurl+"/#/pages/yaoqing/xiangqing",
							shareUrl: this.weixinhttpurl+"/#/pages/yaoqing/xiangqing",
							imgUrl: "http://img5.imgtn.bdimg.com/it/u=1563801134,1580875113&fm=26&gp=0.jpg"
						};
						jweixin.onMenuShareAppMessage(shareData); //分享好友
						jweixin.onMenuShareTimeline(shareData); //分享朋友圈
					});

					// #endif

				}
			})
		},

		methods: {

		}

	}
</script>
